﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            List<float> score = new List<float>();
            try
            {
                while (true)
                {
                    Console.WriteLine("请输入学生成绩(-1退出)：");
                    float key = float.Parse(Console.ReadLine());

                    if (key == -1)
                    {
                        break;
                    }
                    else
                    {
                        score.Add(key);
                    }
                }
            }
            catch (ArrayTypeMismatchException)
            {
                Console.WriteLine("类型转换异常");
            }
            catch (FormatException)
            {
                Console.WriteLine("异常已处理");
            }
            catch (OverflowException)
            {
                Console.WriteLine("异常已处理");
            }
            catch (Exception)
            {
                Console.WriteLine("异常已处理");
            }
            finally
            {
                Console.WriteLine("最终处理");
            }
            if (score.Count < 0)
            {
                Console.WriteLine("学生没有成绩");
            }
            else
            {
                Console.WriteLine("学生人数为："+score.Count);
                Console.WriteLine("总分为："+score.Sum());
                Console.WriteLine("平均分为："+score.Average());
            }

        }
    }
}
